namespace xhtml = "http://www.w3.org/1999/xhtml"

element library {
  element book {
    attribute id {
      xsd:NMTOKEN { maxLength = "16" }
    },
    attribute available { xsd:boolean },
    element isbn {
      xsd:NMTOKEN { pattern = "[0-9]{9}[0-9x]" }
    },
    element title {
      attribute xml:lang {
        xsd:language { length = "2" }
      },
      xsd:token { maxLength = "255" }
    },
    element author {
      attribute id {
        xsd:NMTOKEN { maxLength = "16" }
      },
      element name {
        xsd:token { maxLength = "255" }
      },
      element born {
        xsd:date {
          minInclusive = "1900-01-01"
          maxInclusive = "2099-12-31"
          [ xhtml:p = "We don't want timezones in our dates." ]
          pattern = "[0-9]{4}-[0-9]{2}-[0-9]{2}"
        }
      },
      element dead {
        xsd:date {
          minInclusive = "1900-01-01"
          maxInclusive = "2099-12-31"
          pattern = "[0-9]{4}-[0-9]{2}-[0-9]{2}"
        }
      }?
    }*,
    element character {
      attribute id {
        xsd:NMTOKEN { maxLength = "16" }
      },
      element name {
        xsd:token { maxLength = "255" }
      },
      element born {
        xsd:date {
          minInclusive = "1900-01-01"
          maxInclusive = "2099-12-31"
          pattern = "[0-9]{4}-[0-9]{2}-[0-9]{2}"
        }
      },
      element qualification {
        xsd:token { maxLength = "255" }
      }
    }*
  }+
}
